package com.example.zwgt.yrfk.ui.access.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Switch;
import android.widget.TextView;

import com.example.zwgt.yrfk.R;
import com.example.zwgt.yrfk.base.mvpbase.BasePresenter;
import com.example.zwgt.yrfk.base.mvpbase.baseImpl.BaseActivity;
import com.example.zwgt.yrfk.bean.TestBean;
import com.example.zwgt.yrfk.ui.video.single.CallManager;
import com.example.zwgt.yrfk.ui.video.single.VideoCallActivity;

import butterknife.BindView;
import butterknife.OnClick;

public class AccessDetailActivity extends BaseActivity {


    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.tv_guestdetails_status)
    TextView tvGuestdetailsStatus;
    @BindView(R.id.tv_guestdetails_phone)
    TextView tvGuestdetailsPhone;
    @BindView(R.id.et_guestdetails_name)
    TextView etGuestdetailsName;
    @BindView(R.id.tv_guestdetails_applycredit)
    TextView tvGuestdetailsApplycredit;
    @BindView(R.id.tv_guestdetails_ctime)
    TextView tvGuestdetailsCtime;
    @BindView(R.id.tv_guestdetails_modifytime)
    TextView tvGuestdetailsModifytime;
    @BindView(R.id.btn_video)
    Button btnVideo;

    private String mId,mPhone,mName,mTime;

    public static void startAction(Context mContext , String id, String name, String phone, String time) {
        Intent intent = new Intent(mContext, AccessDetailActivity.class);
        intent.putExtra("ID", id);
        intent.putExtra("PHONE", phone);
        intent.putExtra("NAME", name);
        intent.putExtra("TIME", time);
        mContext.startActivity(intent);
    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_access_details;
    }

    @Override
    public BasePresenter initPresenter() {
        return null;
    }

    @Override
    protected void initViews() {
        mId=getIntent().getStringExtra("ID");
        mPhone=getIntent().getStringExtra("PHONE");
        mName=getIntent().getStringExtra("NAME");
        mTime=getIntent().getStringExtra("TIME");

        //当前进度
        tvGuestdetailsStatus.setText("当前进度："+mId);
        //姓名
        etGuestdetailsName.setText(mName);
        //手机
        tvGuestdetailsPhone.setText(mTime);
        //额度
        tvGuestdetailsApplycredit.setText(mPhone);
        tvGuestdetailsCtime.setText(mTime);
        tvGuestdetailsModifytime.setText(mTime);



    }


    @OnClick({R.id.iv_back,R.id.btn_video})
    public void onViewClicked(View view) {
        switch(view.getId()){
            case R.id.iv_back:
                finish();
                break;
            case R.id.btn_video:
                callVideo();
                break;
        }
    }

    /**
     * 视频呼叫
     */
    private void callVideo() {
        //checkContacts();
        Intent intent = new Intent(AccessDetailActivity.this, VideoCallActivity.class);
        CallManager.getInstance().setChatId("nnn");
        CallManager.getInstance().setInComingCall(false);
        CallManager.getInstance().setCallType(CallManager.CallType.VIDEO);
        startActivity(intent);
    }
}
